<!DOCTYPE html>
<html>

<head>
	<meta charset="UTF-8">
	<title>编辑游戏-租号狗后台管理系统</title>
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
	<link rel="stylesheet" href="../../../5d824063e09a9/static/css/font.css">
	<link rel="stylesheet" href="../../../5d824063e09a9/static/css/weadmin.css">
	<!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
	<!--[if lt IE 9]>
	<script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
	<script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
	<![endif]-->
</head>

<body>
<div class="weadmin-body">
	<form class="layui-form">
		<div class="layui-form-item">
			<label for="L_gametype" class="layui-form-label">
				<span class="we-red">*</span>游戏类型
			</label>
			<div class="layui-input-inline">
				<input type="text" id="L_gametype" name="gametype" lay-verify="required|gametype" autocomplete="off" class="layui-input">
			</div>
		</div>
		<div class="layui-form-item">
			<label for="L_gamename" class="layui-form-label">
				<span class="we-red">*</span>游戏名称
			</label>
			<div class="layui-input-inline">
				<input type="text" id="L_gamename" name="gamename" lay-verify="required|gamename" autocomplete="" class="layui-input">
			</div>
		</div>
		<div class="layui-form-item">
			<label for="L_gameregion" class="layui-form-label">
				<span class="we-red">*</span>游戏区服
			</label>
			<div class="layui-input-inline">
				<input type="text" id="L_gameregion" name="gameregion" lay-verify="gameregion" autocomplete="off" class="layui-input">
			</div>
		</div>
		<div class="layui-form-item">
			<label for="L_gameregion" class="layui-form-label">
			</label>
			<button class="layui-btn" lay-filter="add" lay-submit="">确定</button>
			<input type="hidden" name="dataId" id="dataId" value="" />
		</div>
	</form>
</div>
<script src="../../../5d824063e09a9/lib/layui/layui.js" charset="utf-8"></script>
<script type="text/javascript">
	layui.extend({
		admin: '{/}../../static/js/admin'
	});
	layui.use(['form', 'jquery', 'admin','layer'], function() {
		var form = layui.form,
				$ = layui.jquery,
				admin = layui.admin,
				layer = layui.layer;

		//页面初始化加载
		$(function(){
			setTimeout(function(){
				frameVal();
			},100);
		});
		function frameVal(){
			var dataId = $('input[name="dataId"]').val();
			var index = parent.layer.getFrameIndex(window.name);
			parent.layui.jquery("#memberList tr").each(function(){
				if($(this).attr('data-id')==dataId){
					console.log($(this));
					var tdArr=$(this).children('td');
					var gametype = tdArr.eq(1).text(); //游戏类型
					var gamename = tdArr.eq(2).text(); //游戏名称
					var gameregion = tdArr.eq(3).text(); //游戏区服

					$('input[name="gametype"]').val(gametype);
					$('input[name="gamename"]').val(gamename);
					$('input[name="gameregion"]').val(gameregion);
					form.render();
				}
			});
		}
		//监听提交
		form.on('submit(add)', function(data) {
			console.log(data);
			//发异步，把数据提交给php
			layer.alert("编辑成功", {
				icon: 6
			}, function() {
				// 获得frame索引
				var index = parent.layer.getFrameIndex(window.name);
				//关闭当前frame
				parent.layer.close(index);
			});
			return false;
		});

	});
</script>
</body>

</html>